package task2;

import sun.plugin2.os.windows.FLASHWINFO;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

public class Computer {
    //接受传递的集合
    private ArrayList list;
    //set/get方法


    public ArrayList getList() {
        return list;
    }

    public void setList(ArrayList list) {
        this.list = list;
    }

    public float max(){
        Collections.sort(list);
        float max=(float) list.get(list.size()-1);
        return max;
    }

    public float min(){
        Collections.sort(list);
        return (float)list.get(0);
    }
    public float avg(){
        Collections.sort(list);

        list.remove(max());
        list.remove(min());
        float sum=0,avg=0;
        Iterator iterator=list.iterator();
        while (iterator.hasNext()){
            sum+=(Float)iterator.next();
        }
        avg=sum/list.size();
        return avg;
    }

}
